package com.cnebula.openapi.auth;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;
import redis.embedded.RedisServer;

public class RedisServerVerticle extends AbstractVerticle{

	RedisServer redisServer;
	private static final Logger log = LoggerFactory.getLogger(RedisServerVerticle.class);
	
	@Override
	public void start(Future<Void> startFuture) throws Exception {
		RedisServer redisServer = new RedisServer(6379);
		redisServer.start();
		log.info("Redis embedded server start up [host:127.0.0.1 , port:6379]");
		startFuture.complete();
	}
	
	@Override
	public void stop(Future<Void> stopFuture) throws Exception {
		if(redisServer != null) {
			redisServer.stop();
		}
		super.stop(stopFuture);
	}
}
